
use gfsc::*;

pub fn main() {
    if std::env::args().len() < 3 {
        println!("{} ihash where_is_router.json", std::env::args().nth(0).unwrap_or_default());
        return
    }
    let ihash = std::env::args().nth(1).expect("no file_name given");    
    let ihash = ihash.parse::<i32>().unwrap_or_default();
    let conf = std::env::args().nth(2).expect("no router.json given");
    let router = gfsc_new_router( conf.as_str() ).unwrap();    
    // let ihash = gfs_filename_hash(filename.as_str());    
    //     let reader = router.get_reader(router.cur_dynasty, ihash).unwrap();        
    let f = gfsc_dir(&router , router.cur_dynasty, ihash, 0, 100);
    let rt = tokio::runtime::Runtime::new().unwrap();
    let r = rt.block_on(f);

    match r{
         Ok(r)=>{
            for i in 0..r.len(){
                println!("{:#?}", r[i]);
            }
         } ,
         Err(err)=>{
            println!("{:#?}", err);
         },
    }   
    
}
 